perm filename Y2.DOC[TEX,ALS] blob sn#613085 filedate 1981-09-23 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	{{\def\dispentry#1#2{{}
C00012 00003
C00019 ENDMK
C⊗;
{{\def\dispentry#1#2{{}
	\spaceskip 3.333pt plus 10pt minus 2pt
	\xspaceskip 4.444pt plus 11pt minus 3pt
	\parindent 0pt
	$$\hbox par 11cm{\hangindent 3cm after 1\hbox to 3cm{#1\hfil\quad}#2}
	$$
	\parindent 20pt
	}

\def\dispar#1\par{{}
	\spaceskip 3.333pt plus 10pt minus 2pt
	\xspaceskip 4.444pt plus 11pt minus 3pt
	\parindent 0pt
	$$\hbox par 10cm{#1}
	$$
	\parindent 20pt
	}

\def\hide#1{\hbox to 0pt{\hss#1}}
\def\α{\hide{-}\ }
\def\β{\hide{$\bullet$}\ }
\def\runningrighthead#1{\gdef\chead{\:m#1}} %\runningrighthead sets chead
 
\advcount0

\secbegin \head{THE SYSTEM DEPENDENT MODULE OF \TEX}\runninglefthead{\TEX: SYSTEM DEPENDENCIES}

 This module contains all the parts of \TEX\ 
that may need some reprogramming for each different system environment. 
If a compiler does not suport external procedures or there is no interest
in reprogramming them to generate more efficient code, it is possible 
to get by just doing as follows:
\dispar \hide{-} Make all necessary changes in this module.\par
\dispar \hide{-} Modify the beginning sections of \.{TEX.DOC} accordingly.\par
\dispar \hide{-} Delete the first, second and last pages of
 \.{SYSDEP.DOC} (the one file you are now reading).\par
\dispar \hide{-} Put the remaining of this module in the place of the external
procedure declarations in \.{TEX.DOC}.\par
the result will be ready for \.{UNDOC} to produce a single \.{TEX.PAS}
source file.\par

 The data structures declared in \TEX\ have been
designed having in mind a machine and a compiler
that packs fields correctly to the byte. That means that
fields in some records are allocated more space than necessary and, some times,
records take extra words to allocate fields that could have been allocated
in prevously assigned words. But the wasted extra space is not very significant,
and probably does not justify the effort to change the structures here and
in the main module. Rather, the size of the structures should be modified if
the memory space is at premium.
}}
program sysdep,
	InitStrings, ProduceString,
	AppndString, AppndReal,
	InitSysdep, Release,
	InChTer, InLnTer,
	OutChErr, OutLnErr,
	SendCh, SendLn, SendStarted, Close,
	Print, PrintLn, PrintInt, PrintReal, PrintFileName,
	PrintOctal,
	InLn, GetFirstLine,
	ForceBufferOut,
	TraceLine, DeclareOFil,
	InitFileName, AppendToName,
	ReadFontInfo,
	DvI,IntOut,CloseOut,
	SetTableSizes, WriteSecondMem, WriteEqTb, WriteHyphenTb,
	WritePageTb, WriteDelimTb, WriteFMem,
	GetTableSizes,InitSecondMem,InitEqTb,InitHyphenTb,
	InitPageTb,InitDelimTb,InitFMem;
const { Constants in the outer block }
type { Types in the outer block }
var { Globals in the outer block }

{{ Definitions for the memory of \TEX}}
{ memsize } := 49152  {{ size of the main memory structure of \TEX }}
{ secondmem } := 25012 {{ size of the part of the main memory used in single node blocks }}

{{ Definitions for the table of equivalents }}
{ hprime } := 89  {{ range of hash values }} 
{ hashsize } := 1009
	{{ hash table size, must be prime and $<2↑{bound\ of\ \\{sixteenbits}-127}$ }} 
{ texpars } := 21 {{ number of distinct parameters settable by \.{\\chpar} }} 
{ locs } := 23  {{ values of local quantities (\.{\\:},\.{\\baselineskip}, etc.) }}
{ eqtbsize } := hashsize+128+128+128+15+texpars
	{{ size of table for current values }} 

{{ Next follows a list of constants that can be adjusted for each installation }}
{ stacksize } := 80 {{ size of input stacks }}
{ pagememsize } := 8 {{ number of page parameters }} 
{ nfonts } := 64 {{ number of fonts allowed (must not be greater than 256) }}
{ maxfnt } := nfonts-1 {{ highest font number }}
{ charsperfont } := 128 {{ assumed number of characters in a font }}
{ maxinfil } := 6 {{ maximum number of input files that can be open at the
							same time }}
{ maxfil } := nfonts+10+maxinfil {{maximum number of file names \TEX\ remembers}}
{ bufsize } := 200  {{ size of the input buffer }} 
{ maxlinelength } := 150 {{ maximum number of characters accepted
			 in a line of a file }} 

{ exceptableEntryLength }	:= 2	{{ size of exceptable entry in words }} 
{ excephyphEntryLength }	:= 2	{{ size of excephyph entry in words }} 
{ suffixEntryLength }		:= 3	{{ size of suffix entry in words }} 
{ prefixEntryLength }		:= 3	{{ size of prefix entry in words }} 
{ btableEntryLength }		:= 3	{{ size of btable entry in words }} 
{ readoutsize }		:= 3	{{ maximum size of the above }} 

{ excepsize }	:= 373 {{ length of hyphenation tables: there should always
			 some slack in the exception table to allow for
			 efficient hashing;  since it is used as the hash
			 modulo, the length should always be prime}} 
{ sufsize }	:= 116
{ prefsize }	:= 109
{ btabsize }	:= 30

{ fmemsize } := 6400 {{ size of font memory for secondary tables }} 
{ fontinfosize } :=  8192 {{ $\\{nfonts}\times 128$ }} 

{ bytesPerWord } := 4	{{ valid both for 32 and 36 bits per word  }}

{ Types in the outer block } +=
oneOfTwo = 1..2;
oneOfFour = 1..4; 
oneOfFive = 1..5; 
oneOfSix = 1..6; 
{{ these types are useful in more complicated declarations. }} 

{{ Ascii codes for some characters not recognized by the preprocessor }}
{ null } := '0
{ linefeed } := '12
{ formfeed } := '14
{ carriagereturn } := '15
{ zero } := '60
{ one } := '61
{ two } := '62
{ three } := '63
{ four } := '64
{ five } := '65
{ six } := '66
{ seven } := '67
{ eight } := '70
{ nine } := '71


{{ \head{The basic record employed by \TEX}\par

 Most of \TEX's data structures are built on top of a single record
structure which is expected to be efficiently stored and accessed in
most systems. That record is declared below. }}
{ eightbits } -= 0..255   {{ an 8-bit field }}

{ sixteenbits } -= 0..65535  {{ a 16-bit field }}

{ Types in the outer block } +=
halves2 = packed record 
		lhword: sixteenbits;
		case oneOfTwo of
			1: (rhword: sixteenbits);
			2: (byte2: eightbits;
			    byte3: eightbits)
		end;
bytes4 = packed record 
		byte0: eightbits;
		byte1: eightbits;
		case oneOfTwo of
			1: (rhword: sixteenbits);
			2: (byte2: eightbits;
			    byte3: eightbits)
		end;
memoryword = packed record case oneOfFour of
		1: (pts: real);
		2: (int: integer);
		3: (twohalves: halves2);
		4: (fourbytes: bytes4)
		end;



{{ An error has been found in section 453 on page 157 of the main
operating module of \TEX . This should be replaced by the following.
The changes involve replacing the word linq with link and adding a missing
line of shift:=0.0; }}

{ Attach equation number } =
begin
q:=getnode(gluenodesize); typ(q):=gluenode; gluelink(q):=fillglue;
if leqno then 
	begin link(q):=b;
	link(eqnobox):=q;
	b:=hpack(eqnobox,dw-shift,false); {{ \\{eqno} will be left justified }}
	shift:=0.0;
	end
else begin link(q):=eqnobox;
	link(b):=q;
	b:=hpack(b,dw-shift,false)  {{ \\{eqno} will be right-justified }}
	end
end

{{ The following procedure should work on both 36-bit and 32-bit
machines and specifically on those machines where the previous
procedure (in section 37 on page 18 of the SYSDEP module)
caused overflow problems }}

procedure PrintOctal(n: integer); {{ Prints the rightmost 32 bits
					of an integer in octal }}
  var i,k: integer;
    s: array [0..10] of asciiCode;
    msb,mbb: boolean;
  begin
  msb:=false; mbb:=false;
  if n<0 then begin n:=-n; msb:=true end; 
  for k:=10 downto 0 do
    begin
    i:=n mod 8;
    if k=0 then
      begin
      if msb then
	begin
	if i>3 then i:=7-i  {{ must be a 36 bit word }}
	else
	  begin 
	  if (i mod 2)=0 then i:=3 else i:=2
	  end
	end
      else i:=(i mod 4)
      end
    else
      begin
      if msb=true then
	begin
	if mbb=true then i:= 7-i    {{ a borrow has propagated }}
	else
	  begin
	  if i>0 then
	    begin
	    i:=8-i;
	    mbb:=true;              {{ a borrow required }}
	    end
	  end
	end;
      end;
      case i of
	0: s[k]:=zero;
	1: s[k]:=one;
	2: s[k]:=two;
	3: s[k]:=three;
	4: s[k]:=four;
	5: s[k]:=five;
	6: s[k]:=six;
	7: s[k]:=seven
      end;
    n:= n div 8;
    end;
  Print(''''');
  k:=0; while (k<10) and (s[k]=zero) do Increment(k);
  for k:=k to 10 do Print(s[k])
  end;

{{ The following is to be a slide }}

program YIELD(OUTPUT);
var  BRACKET,YIELD: integer;
begin
   writeln('Break even Bracket in terms of current yield');
   writeln('current   Tax');
   writeln('yield   bracket');
   for YIELD:=13 to 30 do
   begin
      BRACKET :=100 -(1260 div YIELD);
      if BRACKET <= 50 then writeln(YIELD:3,BRACKET:9);
   end;
end.